package com.example.demo.heartbeat;

import io.netty.channel.Channel;
import io.netty.channel.ChannelInitializer;
import io.netty.handler.timeout.IdleStateHandler;


public class HeartBeatInitializer extends ChannelInitializer<Channel> {


    @Override
    protected void initChannel(Channel channel) throws Exception {
        channel.pipeline()
                //一份秒没有收到消息 将IdleStateHandler 添加到 ChannelPipeline 中
                //(8)
                .addLast(new IdleStateHandler(60, 0, 0))
                //(9)
                .addLast(new HeartBeatDecoder())
                //(10)
                .addLast(new HeartBeatSimpleHandle());
    }
}
